import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        login: {
            switch_text: "免密码登陆",
            header_text: "密码登陆",
            input1_text: "请输入手机号或邮箱",
            input2_text: "请输入密码",
            input2_show: true,
            button_text: "登陆",
        },
        button: {
            value: "",
        }
    },
    mutations: {
        switchstatus(state) {
            if (state.login.input2_show === true) {
                state.login.switch_text = "密码登陆";
                state.login.header_text = "短信验证";
                state.login.input1_text = "请输入手机号";
                state.login.input2_show = false;
                state.login.button_text = "获取短信";
            }
            else {
                state.login.switch_text = "免密码登陆";
                state.login.header_text = "密码登陆";
                state.login.input1_text = "请输入手机号或邮箱";
                state.login.input2_show = true;
                state.login.button_text = "登陆";
            }
        },
       commit(val,state){
        state.button.value = val;
       }

    }
})
